package com.itlong.cloud.commons.resource;

import com.itlong.cloud.POJO.DTO.property.PropertyPaymentTradeDTO;
import com.itlong.cloud.POJO.DTO.property.PropertyPaymentTradeGetPageDTO;
import com.itlong.cloud.POJO.PO.HuaweiOrderInfoPO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentTradeInfoAllVO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentTradeInfoVO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentTradeVO;
import com.itlong.cloud.commons.service.IPaymentTradeService;
import com.itlong.cloud.paymenthub.IPaymentTradeServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      订单管理接口暴露实现类
 * </desc>
 *
 * @createDate 2019/05/23
 */
@RestController
public class PaymentTradeServiceResource implements IPaymentTradeServiceClient {

    @Autowired
    private IPaymentTradeService iPaymentTradeService;

    /**
     * <desc>
     *      分页查询付费通行订单
     * </desc>
     *
     * @param propertyPaymentTradeDTO 订单管理DTO
     * @return 付费通行订单分页信息
     * @author wangzhi
     * @createDate 2019/05/23
     */
    @Override
    @PostMapping("/property/payForPassTrade/getPage")
    public Page<PropertyPaymentTradeVO> getPage(@RequestBody PropertyPaymentTradeDTO propertyPaymentTradeDTO) throws Exception {
        return iPaymentTradeService.getPage(propertyPaymentTradeDTO);
    }

    /**
     * <desc>
     *      查询导出的付费通行订单列表
     * </desc>
     *
     * @param propertyPaymentTradeDTO 订单管理DTO
     * @return 导出的付费通行订单列表
     * @author wangzhi
     * @createDate 2019/05/23
     */
    @Override
    @PostMapping("/property/payForPassTrade/getExportData")
    public List<PropertyPaymentTradeVO> getExportData(@RequestBody PropertyPaymentTradeDTO propertyPaymentTradeDTO) throws Exception {
        return iPaymentTradeService.getExportData(propertyPaymentTradeDTO);
    }

    /**
     * <desc>
     *      分页获取所有支付订单信息
     * </desc>
     *
     * @param propertyPaymentTradeGetPageDTO 支付订单查询参数DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2019/10/18
     */
    @Override
    @PostMapping("/property/paymentSettings/getPaymentTradeByPage")
    public Page<PropertyPaymentTradeInfoVO> getPaymentTradeByPage(@RequestBody PropertyPaymentTradeGetPageDTO propertyPaymentTradeGetPageDTO) throws Exception{
        return iPaymentTradeService.getPaymentTradeByPage(propertyPaymentTradeGetPageDTO);
    }

    /**
     * <desc>
     *      运营获取直接到账的支付订单列表
     * </desc>
     *
     * @param propertyPaymentTradeGetPageDTO
     * @return
     * @Author Zhu.yj
     * @createDate  2019/10/23
     */
    @Override
    @PostMapping("/operate/finance/directPaymentTrade/getOperatePaymentTradeByPage")
    public PropertyPaymentTradeInfoAllVO getOperatePaymentTradeByPage(@RequestBody PropertyPaymentTradeGetPageDTO propertyPaymentTradeGetPageDTO) throws Exception {
        return iPaymentTradeService.getOperatePaymentTradeByPage(propertyPaymentTradeGetPageDTO);
    }

    /**
     * <desc>
     *      统计运营直接到账的支付订单总金额
     * </desc>
     *
     * @param
     * @return
     * @Author Zhu.yj
     * @createDate  2019/10/30
     */
    @Override
    @PostMapping("/operate/finance/getOperatePaymentTradePriceCount")
    public String getOperatePaymentTradePriceCount() throws Exception {
        return iPaymentTradeService.getOperatePaymentTradePriceCount();
    }

    /**
     * <desc>
     *      保存华为SaaS信息
     * </desc>
     *
     * @param po
     * @return
     * @Author Qiang.S
     * @createDate  2020/04/22
     */
    @Override
    @PostMapping("/operate/finance/saveHuaweiSaaSData")
    public void saveHuaweiSaaSData(@RequestBody HuaweiOrderInfoPO po) throws Exception {
        iPaymentTradeService.saveHuaweiSaaSData(po);
    }
}
